package mediator;

public class ConcreteMediator implements Mediator {

    private ConcreteColleagueA colleagueA;

    private ConcreteColleagueB colleagueB;

    @Override
    public void changed(Colleague colleague) {
        if (colleague == colleagueB) {
            colleagueA.someOperation();
        }
        if (colleague == colleagueA) {
            colleagueB.someOperation();
        }
    }

    public Colleague getColleagueA() {
        return colleagueA;
    }

    public void setColleagueA(Colleague colleagueA) {
        this.colleagueA = (ConcreteColleagueA) colleagueA;
    }

    public Colleague getColleagueB() {
        return colleagueB;
    }

    public void setColleagueB(Colleague colleagueB) {
        this.colleagueB = (ConcreteColleagueB) colleagueB;
    }
}
